/**
 * Created by jiaaobo on 16/11/22.
 */


import {Net} from "util";

export  default class BIZ_API {


  /**
   * 根据不同位置获取banner集合
   * @param type banner所处位置
   */
  static getBannerListByType(type){
    return Net.postCicadaJSON(HOST+"/common/getBannerList.do",{},{type : type});
  }

  /**
   * 用户根据微信openid查询用户信息
   * @param openId
   */
  static queryUserBaseInfo(){
    return Net.postCicadaJSON(HOST+"/user/queryUserBaseInfo.do",{},{});
  }

  /**
   * 根据用户ID查询用户最近的一次有效预约
   * @param userId
   */
  static queryUserAppointInfo(){
    return Net.postCicadaJSON(HOST+"/appoint/queryUserAppointInfo.do",{},{});
  }

  /**
   * 根据用户ID和预约ID请求开门操作
   */
  static openTheDoor(obj,config){
    return Net.postCicadaJSON(HOST+"/appoint/openTheDoor.do",{},obj,config);
  }


  /**
   * 基于用户地理位置查询门店列表
   * lat,lng
   */
  static getStoreList(data,config){
    return Net.postCicadaJSON(HOST+"/store/getStoreList.do",{},data,config);
  }


  /**
   * 根据门店ID获取单个门店信息
   * storeId
   */
  static getSingleStoreInfo(data){
    return Net.postCicadaJSON(HOST+"/store/getSingleStoreInfo.do",{},{storeId   : data.storeId});
  }


  /**
   * 根据时间段获取同行小伙伴
   */
  static queryTogetherUsers(data,config){
    return Net.postCicadaJSON(HOST+"/appoint/queryTogetherUsers.do",{},data,config);
  }


  /**
   * 兑换代金券
   * code
   * userId,
   * couponCode
   */
  static exchangeVoucher(obj,config){

    if(obj.type == "code"){
      return Net.postCicadaJSON(HOST+"/coupon/userExSingleCoupon.do.do",{},obj,config);
    }
    else{
      return Net.postCicadaJSON(HOST+"/coupon/userExBatchCoupon.do.do.do",{},obj,config);
    }
  }


  /**
   * 查找用户所有代金券
   */
  static queryUserCoupons(userId){
    return Net.postCicadaJSON(HOST+"/coupon/queryUserCoupons.do",{},{userId   : userId});
  }


  /**
   * 根据用户ID查询用户上次健身是否有欠费，及欠费金额
   */
  static queryUserArrears(data,config){
    return Net.postCicadaJSON(HOST+"/order/queryUserArrears.do",{},{},config);
  }



  /**
   * 下单预约
   */
  static commitAppoint(data){
    return Net.postCicadaJSON(HOST+"/appoint/commitAppoint.do",{},data);
  }


  /**
   * 用户查看自己的预约记录
   */
  static queryAppointList(data,config){
    return Net.postCicadaJSON(HOST+"/appoint/queryAppointList.do",{},{type : data.type , requestTime : data.requestTime},config);
  }

  /**
   * 用户的预约详情
   */
  static queryAppointDetailInfo(appointId,config){
    return Net.postCicadaJSON(HOST+"/appoint/queryAppointDetailInfo.do",{},{appointId : appointId},config);
  }

  /**
   * 用户的预约详情
   */
  static cancelAppoint(appointId,config){
    return Net.postCicadaJSON(HOST+"/appoint/cancelAppoint.do",{},{appointId : appointId},config);
  }


  /**
   * 绑定手机
   */
  static updateUserPhone(phone,smsCode,config){
    return Net.postCicadaJSON(HOST+"/user/updateUserPhone.do",{},{phone : phone,smsCode : smsCode},config);
  }

  /**
   * 查询用户详细信息
   */
  static queryUserDetailInfo(){
    return Net.postCicadaJSON(HOST+"/user/queryUserDetailInfo.do",{},{});
  }

  /**
   * 修改用户详细信息
   */
  static updateUserInfo(data,config){
    return Net.postCicadaJSON(HOST+"/user/updateUserInfo.do",{},data,config);
  }
  /**
   * 排行
   */
  static getUserRank(data,config){
    return Net.postCicadaJSON(HOST+"/user/getUserRank.do",{},data,config);
  }

  /**
   * 获得邀请详情
   */
  static getInviteDetail(data,config){
    return Net.postCicadaJSON(HOST+"/relation/getInviteDetail.do",{},data,config);
  }

  /**
   * 获得邀请
   */
  static getInviteInfo(invitedUserId,config){
    return Net.postCicadaJSON(HOST+"/relation/getInviteInfo.do",{},{invitedUserId : invitedUserId},config);
  }




  /** 基础服务 begin **/


  /**
   * 用户请求发送验证码
   */
  static baseSendSmsCode(userId,phone){
    return Net.postCicadaJSON(HOST+"/common/sendSmsCode.do",{},{userId : userId ,phone : phone});
  }

  /**
   * 校验验证码
   */
  static baseCheckSmsCode(userId,phone,smsCode){
    return Net.postCicadaJSON(HOST+"/common/checkSmsCode.do",{},{userId : userId,phone : phone, smsCode : smsCode});
  }

  /**
   * 获得帮助列表
   */
  static getHelpDoc(data,config){
    return Net.postCicadaJSON(HOST+"/common/getHelpDoc.do",{},data,config);
  }


  /** 基础服务  end **/










}
